//
//  FAITHChooseViewController.m
//  彩票
//
//  Created by FAITH on 16/10/9.
//  Copyright © 2016年 FAITH. All rights reserved.
//

#import "XCChooseViewController.h"
#import "XCTabBarController.h"
#import "XCNewFeatureController.h"
#import "XCAdvertisementVC.h"
@implementation XCChooseViewController
+(void)chooseRootViewController:(UIWindow *)window
{
    static NSString *const versionKey=@"CFBundleShortVersionString";
    //获取上次的版本号
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *lastVersion = [defaults objectForKey:versionKey];
    
    //获取当前版本号
    NSString *curVersion=[NSBundle mainBundle].infoDictionary[versionKey];
    
    //对比两个版本号
    if ([curVersion isEqualToString:lastVersion]) {
        //让tabbarvontroller成为主窗口的跟控制器
//        XCTabBarController *tabbarController=[[XCTabBarController alloc] init];
        XCAdvertisementVC *AVC = [[XCAdvertisementVC alloc] init];
         window.rootViewController= AVC;
    }else{
    
    
        XCNewFeatureController *newFeature=[[XCNewFeatureController alloc] init];
        
        window.rootViewController=newFeature;
        
        [defaults setObject:curVersion forKey:versionKey];
        [defaults synchronize];
        }

}
@end
